package com.yangtzeu.jwc.businessservice.impl;

import android.content.Context;

import com.yangtzeu.jwc.activity.MainActivity;
import com.yangtzeu.jwc.businessservice.BusinessHttpCallBack;
import com.yangtzeu.jwc.dao.StudentDao;
import com.yangtzeu.jwc.dao.impl.StudentDaoImpl;
import com.yangtzeu.jwc.domain.Student;

import java.io.IOException;

public class StudentServiceImpl {
    StudentDao studentDaoImpl = StudentDaoImpl.getInstance();
    private static StudentServiceImpl userService = new StudentServiceImpl();

    public static StudentServiceImpl getInstance() {
	return userService;
    }

    public void login(final String username, final String password, final String type, final BusinessHttpCallBack callBack) {
	studentDaoImpl.login(username, password, type, callBack);
    }

    public void getStudentInfo(final BusinessHttpCallBack callBack) {
	studentDaoImpl.getStudentInfo(callBack);
    }

    public void queryScore(final boolean fromCache,final BusinessHttpCallBack callBack) {
	studentDaoImpl.queryScore(fromCache,callBack);
    }

    public void queryBxkJd(final BusinessHttpCallBack callBack) {
	studentDaoImpl.queryBxkJd(callBack);
    }

    public void queryXwkJd(final BusinessHttpCallBack callBack) {
	studentDaoImpl.queryXwkJd(callBack);
    }

    public void saveStudent(Context context, String name, String password) {
	// 删除原先的记录
	studentDaoImpl.clearStudent(context);
	// 保存新的记录
	studentDaoImpl.saveStudent(context, name, password);
    }

    public void modifySavedStudent(Context context, String name, String password) {
	// 保存新的记录
	studentDaoImpl.modifySavedStudent(context, name, password);
    }

    public void clearStudent(Context context) {
	studentDaoImpl.clearStudent(context);
    }

    // 得到保存的用户
    public Student getSavedStudent(Context context) {
	return studentDaoImpl.getSavedStudent(context);
    }

    public void getXkInfo(BusinessHttpCallBack callBack) {
	studentDaoImpl.getXkInfo(callBack);
    }

    public void getXkInfo(String selYear, String selTerm, String selXiaoqu, BusinessHttpCallBack callBack) {
	studentDaoImpl.getXkInfo(selYear, selTerm, selXiaoqu, callBack);
    }

    public void getGxk(String xiaoqu, BusinessHttpCallBack callBack) {
	studentDaoImpl.getGxk(xiaoqu, callBack);
    }

    public void xxGxk(String courseId, BusinessHttpCallBack callBack) {
	studentDaoImpl.xxGxk(courseId, callBack);
    }

    public void qxxxGxk(Student student, String courseId, BusinessHttpCallBack callback) {
	studentDaoImpl.qxxxGxk(student, courseId, callback);
    }

    public void changePassword(String newPassword, BusinessHttpCallBack callBack) {
	studentDaoImpl.changePassword(newPassword, callBack);
    }
    public void queryKbSelection(BusinessHttpCallBack callBack) {
	studentDaoImpl.getKbSelection(callBack);
    }

    public void queryClass(String selYear, String selTerm, String selDepart, String selClass, BusinessHttpCallBack callBack) {
	studentDaoImpl.queryClass(selYear, selTerm, selDepart, selClass, callBack);
    }

    public void queryKebiao(String selYear, String selTerm, String selDepart, String selClass, BusinessHttpCallBack callBack) {
	studentDaoImpl.queryKb(selYear, selTerm, selDepart, selClass, callBack);
    }
}
